$(function () { 

    var BASE_URL = "https://dc-api.rupee-mama.in";

    new FAQs();

    function FAQs() {

        this.init = function () {

            this.question = $(".faqs-list h2");

            this.getProtocolUrl();

            this.bind();
        };

        this.bind = function () {

            var self = this;

            self.question.bind('click', function () {
                $(this).parent().toggleClass('active');
                $(this).parent().find('div').fadeToggle(500);
            });

        };

        this.getProtocolUrl = function () {
            $.ajax({
                type: "POST",
                url: BASE_URL + '/config/protocol/get',
                headers: {
                    "Content-Type": "application/json"
                },
                dataType: 'json',
                success: function (json) {
                    if (json.code === 0) {
                        $("#privacyPolicy").attr("href", json.data.privacyPolicy);
                        $("#registerProtocol").attr("href", json.data.registerProtocol);
                    }
                }
            })
        };

        this.init();
    }
});